using System;
using System.Collections.Generic;
using GADC.Domain;
using NHibernate;
using NHibernate.Criterion;

namespace GADC.Dao
{
    public class AdminDao : AbstractNHibernateDao<Admin, int>
    {
        public Admin QueryByNameAndPassword(string name, string password)
        {
            return NHibernateSession.CreateCriteria(typeof(Admin))
                                    .Add(Expression.Eq("Name", name))
                                    .Add(Expression.Eq("Password", password))
                                    .UniqueResult<Admin>();
        }

        public Admin QueryByName(string name)
        {
            return NHibernateSession.CreateCriteria(typeof(Admin))
                                    .Add(Expression.Eq("Name", name))
                                    .UniqueResult<Admin>();
            
        }
    }
}
